import matplotlib.pyplot as plt
data = {}
for line in open('test.log'):
    arr = line.split(', ')
    if arr[0] not in data:
        data[arr[0]] = []
    data[arr[0]].append(arr[1])

print data

x = []
y = []

for k, v in data.items():
    i = 1
    for vv in v:
        if vv == '0':
            x.append(i)
            y.append(k)
        i += 1


x1 = []
y1 = []

for k, v in data.items():
    i = 1
    for vv in v:
        if vv == '1':
            x1.append(i)
            y1.append(k)
        i += 1

plt.figure(figsize=(16,9))
p1 = plt.scatter(x, y, s=2, marker='.')
p2 = plt.scatter(x1, y1, s=2, marker=',')
plt.xlabel('Message index')
plt.ylabel('Router id')
plt.legend([p1, p2], ['Add route', 'Remove route'])
plt.yticks(rotation=0, fontsize=4)
plt.show()
# plt.savefig('ana.png')